package com.woniuxy.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.Version;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Employee {

    private Long id;
    private String name;
    private byte gender;
    private Date birthday;
    private Integer departId;
    private Double salary;
    @TableLogic(delval = "1",value = "0")//这是一个逻辑删除的字段
    private Integer deleted=0;

    @Version //这个字段用于版本控制
    private Integer version =0;

    @TableField(fill = FieldFill.INSERT)//在插入操作的时候填充
    private Date createTime; //创建时间
    @TableField(fill = FieldFill.INSERT_UPDATE)//插入和更新时填充
    private Date updateTime; //更新时间


    public Employee(Long id, String name, byte gender, Date birthday, Integer departId, Double salary) {
        this.id = id;
        this.name = name;
        this.gender = gender;
        this.birthday = birthday;
        this.departId = departId;
        this.salary = salary;
    }
}
